﻿function numboxPaste() {
//    clipboardData.setData('text', clipboardData.getData('text').replace(/[^\d]/g, '')); /^(\d+)(\.?)(\d{0,2})$/
    clipboardData.setData('text', clipboardData.getData('text').replace(/[,]/g, ''));
}
function isInt() {
    if ((event.keyCode >= 48) && (event.keyCode <= 57)) {
        event.returnValue = true;
    }
    else {
        event.returnValue = false;
    }
}
function isDecimal() {
    if ((event.keyCode >= 48) && (event.keyCode <= 57) || (event.keyCode == 46)) {
        event.returnValue = true;
    }
    else {
        event.returnValue = false;
    }
}
function checkAll(spanChk, chkName) {
    var elm = document.getElementsByName(chkName);
    if (elm != null) {
        for (i = 0; i < elm.length; i++)
            elm[i].checked = spanChk.checked;
    }
}
function doListDelConfirm(chkIDName,chkAllName) {
    var elm = document.getElementsByName(chkIDName);
    var isChecked = false;
    if (elm != null) {
        for (i = 0; i < elm.length; i++) {
            if (elm[i].checked) {
                isChecked = true;
                break;
            }
        }
    }
    if (!isChecked) {
        alert('请选择要删除的记录后再执行此操作！');
        return false;
    }
    if (confirm("你确定要删除选中的记录吗？")) {
        return true;
    }
    else {
        var elm2 = document.getElementsByName(chkAllName);
        for (i = 0; i < elm2.length; i++) {
            elm2[i].checked = false;
        }
        for (i = 0; i < elm.length; i++) {
            elm[i].checked = false;
        }
        return false;
    }
}
function getNoSelectionAlert(chkName, alertMsg) {
    var elm = document.getElementsByName(chkName);
    if (elm != null) {
        for (i = 0; i < elm.length; i++) {
            if (elm[i].checked) {
                return true;                
            }
        }
    }
    alert(alertMsg);
    return false;
}
function setGridView(id) {
    var tab = document.getElementById(id);
    if (tab != null) {
        for (var i = 1; i < tab.rows.length - 1; i++) {//去掉表头和分页的行
            if (tab.rows[i].rowIndex % 2 == 0) {
                tab.rows[i].className = "a1";
                tab.rows[i].onmouseout = function () { this.className = "a1"; }
            }
            else {
                tab.rows[i].onmouseout = function () { this.className = ""; }
            }
            tab.rows[i].onmouseover = function () { this.className = "a2"; }
        }
    }
}
function setGridView2(id) {
    var tab = document.getElementById(id);
    if (tab != null) {
        for (var i = 1; i < tab.rows.length; i++) {//去掉表头
            if (tab.rows[i].rowIndex % 2 == 0) {
                tab.rows[i].className = "a1";
                tab.rows[i].onmouseout = function () { this.className = "a1"; }
            }
            else {
                tab.rows[i].onmouseout = function () { this.className = ""; }
            }
            tab.rows[i].onmouseover = function () { this.className = "a2"; }
        }
    }
}
function getRootPath() {
    var strFullPath = window.document.location.href;
    var strPath = window.document.location.pathname;
    var pos = strFullPath.indexOf(strPath);
    var prePath = strFullPath.substring(0, pos);
    var postPath = strPath.substring(0, strPath.substr(1).indexOf('/') + 1);
    return (prePath + postPath);
}